const app = getApp();
Page({
  data: {
    //获取从哪个徽章点击进来
    hid: null,
    //徽章详情开关
    openhuizhang: false,
    //获取类目名称
    lmname: '',
    //获取徽章名称
    huiname: '',
    //徽章数据
    goaldata:{'get':true},
    //徽章相关的圈子数据
    goalarr: [{ "qName": "测试数据", "logo": "https://image.xingqubaike.com:8443/minicard/ucenter/personhome/homesetup/xigua.png", "setDate": "2018.05.05", "diarySum": "666" }, { "qName": "测试数据", "logo": "https://image.xingqubaike.com:8443/minicard/ucenter/personhome/homesetup/qiezi.png", "setDate": "2018.08.05", "diarySum": "200" }, { "qName": "测试数据", "logo": "https://image.xingqubaike.com:8443/minicard/ucenter/personhome/homesetup/yumi.png", "setDate": "2018.11.05", "diarySum": "98" }, { "qName": "测试数据", "logo": "https://image.xingqubaike.com:8443/minicard/ucenter/personhome/homesetup/luobo.png", "setDate": "2019.01.05", "diarySum": "2" }, { "qName": "测试数据", "logo": "https://image.xingqubaike.com:8443/minicard/ucenter/personhome/homesetup/huanggua.png", "setDate": "2019.05.15", "diarySum": "0" }],
    //获得徽章总人数
    sumrs: 4059245,
    //优惠券金额
    youhui: 5,
    logininfo:{}
  },
  //获取从什么标记进入的页面
  onLoad: function (options) {
    var _this = this
    _this.setData({
      logininfo: app.globalData.logininfo,
      openid: app.globalData.logininfo.openid,
    });
    _this.setData({
      getopenid: this.data.openid
    })
    _this.setData({
      hid: options.h_id
    })
    if (_this.data.hid == 1) {
      wx.setNavigationBarTitle({
        title: '亲子 · 徽章'
      })
      this.setData({
        lmname: "亲子",
      })
    }
    if (_this.data.hid == 2) {
      wx.setNavigationBarTitle({
        title: '生活 · 徽章'
      })
      this.setData({
        lmname: "生活",
      })
    }
    if (_this.data.hid == 3) {
      wx.setNavigationBarTitle({
        title: '阅读 · 徽章'
      })
      this.setData({
        lmname: "阅读",
      })
    }
    if (_this.data.hid == 4) {
      wx.setNavigationBarTitle({
        title: '美食 · 徽章'
      })
      this.setData({
        lmname: "美食",
      })
    }
    if (_this.data.hid == 5) {
      wx.setNavigationBarTitle({
        title: '教育 · 徽章'
      })
      this.setData({
        lmname: "教育",
      })
    }
    if (_this.data.hid == 6) {
      wx.setNavigationBarTitle({
        title: '健康 · 徽章'
      })
      this.setData({
        lmname: "健康",
      })
    }
    if (_this.data.hid == 7) {
      wx.setNavigationBarTitle({
        title: '运动 · 徽章'
      })
      this.setData({
        lmname: "运动",
      })
    }
    if (_this.data.hid == 8) {
      wx.setNavigationBarTitle({
        title: '才艺 · 徽章'
      })
      this.setData({
        lmname: "才艺",
      })
    }
    if (_this.data.hid == 9) {
      wx.setNavigationBarTitle({
        title: '旅游 · 徽章'
      })
      this.setData({
        lmname: "旅游",
      })
    }
    if (_this.data.hid == 10) {
      wx.setNavigationBarTitle({
        title: '时尚 · 徽章'
      })
      this.setData({
        lmname: "时尚",
      })
    }
    if (_this.data.hid == 11) {
      wx.setNavigationBarTitle({
        title: '财富 · 徽章'
      })
      this.setData({
        lmname: "财富",
      })
    }
    if (_this.data.hid == 12) {
      wx.setNavigationBarTitle({
        title: '娱乐 · 徽章'
      })
      this.setData({
        lmname: "娱乐",
      })
    }
    if (_this.data.hid == 13) {
      wx.setNavigationBarTitle({
        title: '行业活动 · 徽章'
      })
      this.setData({
        lmname: "行业活动",
      })
    }
    if (_this.data.hid == 14) {
      wx.setNavigationBarTitle({
        title: '互联网 · 徽章'
      })
      this.setData({
        lmname: "互联网",
      })
    }
    if (_this.data.hid == 15) {
      wx.setNavigationBarTitle({
        title: '公益 · 徽章'
      })
      this.setData({
        lmname: "公益",
      })
    }
    if (_this.data.hid == 16) {
      wx.setNavigationBarTitle({
        title: '技能 · 徽章'
      })
      this.setData({
        lmname: "技能",
      })
    }
    if (_this.data.hid == 17) {
      wx.setNavigationBarTitle({
        title: '神秘 · 徽章'
      })
      this.setData({
        lmname: "神秘",
      })
    }
  },
  onShareAppMessage() {
    return {
      title: '好玩的百科知识平台',
      desc: '',
      path: '/pages/home/home'
    }
  },
  //跳转优惠券包
  gotowallet: function(){
    wx.navigateTo({
      url: '../wallet/wallet',
    })
  },
  //打开徽章详情
  showopen: function () {
    this.setData({
      openhuizhang: true
    })
  },
  //关闭徽章详情
  closeopen: function(){
    this.setData({
      openhuizhang: false
    })
  }
})